package MOLE;

/** 
 Tsaipyao ��ժҪ˵����
*/
public class Tsaipyao
{

	 private String StartTime = "09:48:00";
	 private int PerMinuts = 10;

	private int PerSeconds;
	  public int StartSeconds;

	public Tsaipyao()
	{

		StartSeconds = GetStartSec();
		PerSeconds = PerMinuts * 60;
	}


	private int GetStartSec()
	{
		String [] a = StartTime.split("[:]", -1);
		int h = Integer.parseInt(a[0]);
		int m = Integer.parseInt(a[1]);
		int s = Integer.parseInt(a[2]);
		int startsecs = h * 3600 + m * 60 + s;
		return startsecs;

	}



	public final int GetNowSeconds()
	{

		int h = java.time.LocalDateTime.now().getHour();
		int m = java.time.LocalDateTime.now().getMinute();
		int s = java.time.LocalDateTime.now().getSecond();
		int startsecs = h * 3600 + m * 60 + s;
		return startsecs;

	}


	public final int NextStartTimeWait()
	{
//C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java:
			///#region

		int span = GetNowSeconds() - StartSeconds;
		if (span < 0)
		{
			return 0;
		}
		int i = span % PerSeconds; //past sec

		return PerSeconds - i;

//C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java:
			 ///#endregion
	}


	public final int Cyihaor()
	{
//C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java:
			///#region
		int span = GetNowSeconds() - StartSeconds;
	//	if(span<0)return 0;
		double d = (double)span / (double)PerSeconds;

	  int qihao = (int)Math.ceil(d);


		return qihao;
//C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java:
			///#endregion
	}


	public static boolean HeZhiOK(int xinji, int hezhi)
	{
//C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java:
			///#region
		if (xinji == 2 && hezhi >= 0 && hezhi <= 18)
		{

			return true;

		}
		if (xinji == 3 & hezhi >= 0 & hezhi <= 27)
		{
			return true;

		}

		return false;
//C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java:
			///#endregion

	}
	public static int GetHezhiZhushu(int hezhi, int xinji)
	{
//C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java:
			///#region
		String s = "";
		int num = hezhi;
		int i,j,k,n = 0;
		for (i = 0;i < 10;i++)
		{
			for (j = 0;j < 10;j++)
			{
				if (xinji == 2)
				{
					if (i + j == num)
					{
						s = s + " " + i + j;
						n++;
					}
				}
				else //xinji==3
				{
					for (k = 0;k < 10;k++)
					{
						if (i + j + k == num)
						{
							s = s + " " + i + j + k;
							n++;
						}
					}
				}
			}
		}

		return n;
//C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java:
			///#endregion
	}

}